home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 29
/
Volume 29 - JOGO DISK .iso
/
Games
/
jungle_adventure.swf
/
scripts
/
__Packages
/
PerformanceTest.as
< prev
next >
Wrap
Text File
|
2006-11-29
|
2KB
|
71 lines
class PerformanceTest
{
var score = 0;
var time = 0;
var loops = 20;
var complete = false;
function PerformanceTest(itterations, onComplete)
{
if(itterations)
{
this.loops = itterations;
}
this.remainingLoops = this.loops;
if(onComplete)
{
this.onComplete = onComplete;
}
var _loc2_ = System.capabilities.version.substr(4).split(",");
this.flashMajorVersion = Number(_loc2_[0]);
this.flashMinorVersion = Number(_loc2_[2]);
this.complete = false;
this.intervalID = setInterval(function(o)
{
o.test();
}
,0,this);
}
function test()
{
if(this.remainingLoops <= 0)
{
this.finalize();
clearInterval(this.intervalID);
return undefined;
}
this.remainingLoops = this.remainingLoops - 1;
var _loc4_ = getTimer();
var _loc3_ = undefined;
var _loc2_ = 0;
while(_loc2_ < 6400)
{
_loc3_ = {};
_loc2_ = _loc2_ + 1;
}
this.time += getTimer() - _loc4_;
}
function finalize()
{
this.score = Math.floor(this.loops / this.time * 10000);
if(this.flashMajorVersion >= 7)
{
this.log = Math.log(this.score * 0.015);
}
else
{
this.log = Math.log(this.score * 0.023);
}
this.processor = this.log * 1000;
this.complete = true;
this.onComplete(this);
}
function toString()
{
if(this.score)
{
return "Loops:\t" + this.loops + "\nFlash Version: \t" + System.capabilities.version + "\nTotal Time:\t" + this.time + "\nScore: \t" + this.score + "\nProcessor: \t" + this.processor;
}
return "Test In Process.";
}
}